
export const arrayFunc = {
  /**
   *Determine whether an array is empty
   * @returns {boolean}
   */
  isEmpty(arr) {
    return !(arr !== undefined && arr !== null && arr.length > 0);
  },
  /**
   * Determine whether an array contains the unique identifier property of the specified object
   * @param array array
   * @param target Target Object
   * @param id Unique identifier
   */
  contains(array, target, id) {
    if (!array || !target) {
      console.error('The array and target object cannot be empty or underfined');
    } else {
      return array.filter((item) => {
        return item[id] === target[id]
      }).length > 0;
    }
  }

};

